#include <stdio.h>
#include <sys/types.h>          /* See NOTES */
#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>



void s_debug()
{
    printf("debug: %s \r\n", strerror(errno));
    exit(1);
}
int main(int argc, char **argv) 
{
    int socknd;
    struct sockaddr_in servx;
    char buf[255];
    int rt;

    bzero(buf, 255);
    socknd = socket(AF_INET, SOCK_STREAM, 0); 

    servx.sin_family = AF_INET;
    servx.sin_port = htons(181);

    inet_pton(AF_INET, "127.0.0.1", &servx.sin_addr);

    rt = connect(socknd, (struct sockaddr *)&servx, sizeof(servx));
    if(rt < 0) s_debug();
    
    write(socknd, "GET \r\n\r\n", 9); 
    read(socknd, buf, 255);

    //printf("c buf: %s \r\n", buf);

    close(socknd);

    return 0;
}

